package com.leetcode.LC;

public class LC1281 {
    public int subtractProductAndSum(int n) {

        int a = 0, b = 1;
        int num = 0;
        while (n != 0) {
            num = n % 10;
            n /= 10;
            a += num;
            b *= num;
        }

        return b - a;
    }

    public static void main(String[] args) {
        System.out.println(new LC1281().subtractProductAndSum(234));
    }
}
